<?php

/**
 * This is the model class for table "sites".
 *
 * The followings are the available columns in table 'sites':
 * @property integer $site_id
 * @property string $sitename
 * @property string $site_url
 * @property integer $status
 * @property integer $has_captcha
 * @property string $login_url
 * @property string $ad_url
 * @property string $grid_url
 * @property string $account_url
 * @property string $logout_url
 * @property string $captcha_login_url
 * @property string $captcha_login_img_ex
 * @property string $captcha_ad_url
 * @property string $captcha_ad_img_ex
 * @property string $money_xpath
 */
class Sites extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Sites the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sites';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('status, has_captcha', 'numerical', 'integerOnly'=>true),
			array('sitename', 'length', 'max'=>128),
			array('site_url, login_url, ad_url, grid_url, account_url, logout_url, captcha_login_url, captcha_ad_url, money_xpath, login_success_xpath, login_success_value ', 'length', 'max'=>255),
			array('captcha_login_img_ex, captcha_ad_img_ex', 'length', 'max'=>12),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('site_id, sitename, site_url, status, has_captcha, login_url, ad_url, grid_url, account_url, logout_url, captcha_login_url, captcha_login_img_ex, captcha_ad_url, captcha_ad_img_ex, money_xpath', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'site_id' => 'Site',
			'sitename' => 'Sitename',
			'site_url' => 'Site Url',
			'status' => 'Status',
			'has_captcha' => 'Has Captcha',
			'login_url' => 'Login Url',
			'ad_url' => 'Ad Url',
			'grid_url' => 'Grid Url',
			'account_url' => 'Account Url',
			'logout_url' => 'Logout Url',
			'captcha_login_url' => 'Captcha Login Url',
			'captcha_login_img_ex' => 'Captcha Login Img Ex',
			'captcha_ad_url' => 'Captcha Ad Url',
			'captcha_ad_img_ex' => 'Captcha Ad Img Ex',
			'money_xpath' => 'Money Xpath',
			'login_success_xpath' => 'Success Xpath',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('site_id',$this->site_id);
		$criteria->compare('sitename',$this->sitename,true);
		$criteria->compare('site_url',$this->site_url,true);
		$criteria->compare('status',$this->status);
		$criteria->compare('has_captcha',$this->has_captcha);
		$criteria->compare('login_url',$this->login_url,true);
		$criteria->compare('ad_url',$this->ad_url,true);
		$criteria->compare('grid_url',$this->grid_url,true);
		$criteria->compare('account_url',$this->account_url,true);
		$criteria->compare('logout_url',$this->logout_url,true);
		$criteria->compare('captcha_login_url',$this->captcha_login_url,true);
		$criteria->compare('captcha_login_img_ex',$this->captcha_login_img_ex,true);
		$criteria->compare('captcha_ad_url',$this->captcha_ad_url,true);
		$criteria->compare('captcha_ad_img_ex',$this->captcha_ad_img_ex,true);
		$criteria->compare('money_xpath',$this->money_xpath,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}